package com.spm.librarianmanagersystem.mapper;

import com.spm.librarianmanagersystem.pojo.Reservation;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;
import org.apache.ibatis.annotations.Select;

import java.util.Date;
import java.util.List;

@Mapper
@Repository
public interface ReservationMapper {
    @Select("Select user_id From reservation Where ISBN = #{ISBN} and status = 0")
    List<String> getBookReservations(String ISBN);
    
    List<Reservation> getReservations(String currentUserId);

    Reservation getOneReservation(String currentUserId, Integer reservationId);

    Boolean addReservation(Integer userId, String isbn, Date reservationTime);

    Boolean updateReservationForCancel(Integer reservationId);

    Boolean deleteAllByUserID(Integer userID);

    Boolean updateReservationForFinish(Integer userId, String isbn);

    Integer getReservedCount(String isbn);

    Integer getBookInLibraryCount(String isbn);

    List<String> getReservingMembers(String isbn);
    // kai
    Boolean addReser(Reservation reservation);
    // kai
    Reservation getRerservationByReserID(Integer reservationId);

}
